#include "stdafx.h"
#include "ZNetworkBuffer.h"
#include "ZStream.h"
#include "ZUtility.h"

namespace	Z	{

//------------------------------------------------------------------------------------------------------------------------
NetworkBuffer::NetworkBuffer()
{
}

NetworkBuffer::~NetworkBuffer()
{
	for(Streams::iterator i = mStreams.begin(); i != mStreams.end(); ++i)	{
		deletePtr(*i);
	}
}

size_t NetworkBuffer::getReadableSize()	const
{
	size_t readableBufferSize	= 0;
	for(Streams::const_iterator i = mStreams.begin(); i != mStreams.end(); ++i)	{
		readableBufferSize	+= (*i)->getReadableSize();
	}
	return readableBufferSize;
}

size_t NetworkBuffer::getWritableSize()	const
{
	size_t writableBufferSize	= 0;
	for(Streams::const_iterator i = mStreams.begin(); i != mStreams.end(); ++i)	{
		Stream* pStream	= *i;
		writableBufferSize	+= pStream->getWritableSize();
	}
	return writableBufferSize;
}

}